<?php 

class DanhMuc extends CI_Controller
{
	function them()
	{
		$data = array(
			'page'=>'themdanhmuc'
		);
		$this->load->view('admin/templateadmin', $data);
	}
	
	function xulythem()
	{
		$tendm = $this->input->post('tendm');
		$hienthi = $this->input->post('hienthi') == 'true' ? 'true' : 'false';
		$this->mdanhmuchoa->themdanhmuc($tendm, $hienthi);
		redirect('admin/danhmuc/danhsach');
	}
	
	function danhsach()
	{
		$data = array(
			'dsdm'=>$this->mdanhmuchoa->danhsachdanhmucAdmin(),
			'page'=>'danhsachdanhmuc'
		);
		$this->load->view('admin/templateadmin', $data);
	}
	
	function xoadanhmuc($madm)
	{
		$this->mdanhmuchoa->xoadanhmuc($madm);
		redirect('admin/danhmuc/danhsach');
	}
	
	function capnhat($madm)
	{
		$data = array(
			'ttdm'=>$this->mdanhmuchoa->thongtindanhmuc($madm),
			'page'=>'capnhatdanhmuc'
		);
		$this->load->view('admin/templateadmin', $data);
	}
	
	function xulycapnhat()
	{
		$madm = $this->input->post('madm');
		$tendm = $this->input->post('tendm');
		$hienthi = $this->input->post('hienthi') == 'true' ? 'true' : 'false';
		$this->mdanhmuchoa->capnhat($madm, $tendm, $hienthi);
		redirect('admin/danhmuc/danhsach');
	}
	
}

?>